﻿using GBT.ParamEntity;
using Newtonsoft.Json.Linq;
using PersistenceDataLogic.Core;
using QueryDataLogic.Core;
using SqlSugar;
using System;
using System.Linq;

namespace testCore
{
    class Program
    {
        static void Main(string[] args)
        {
            //SqlSugarClient Db;//用来处理事务多表查询和复杂的操作
            //Db = new SqlSugarClient(new ConnectionConfig()
            //{
            //    ConnectionString = "server=115.29.65.173;uid=sa;pwd=Aa123456;database=MealSystem_Test",
            //    DbType = DbType.SqlServer,
            //    InitKeyType = InitKeyType.Attribute,//从特性读取主键和自增列信息
            //    IsAutoCloseConnection = true,//开启自动释放模式和EF原理一样我就不多解释了
            //});
            ////调式代码 用来打印SQL 
            //Db.Aop.OnLogExecuting = (sql, pars) =>
            //{
            //    Console.WriteLine(sql + "\r\n" +
            //        Db.Utilities.SerializeObject(pars.ToDictionary(it => it.ParameterName, it => it.Value)));
            //    Console.WriteLine();
            //};
            //UserVerify uv = new UserVerify();
            //Console.WriteLine(uv.IsUser(2, "88050568012", Db));

            //string param = "{\"mobile\":\"88050568012\",\"number\":\"1234\",\"name\":\"1234\",\"nickName\":\"神赐书宝\",\"country\":\"China\",\"province\":\"Fujian\",\"city\":\"Putian\",\"language\":\"zh_CN\",\"isAdmin\":true,\"isAudit\":false,\"districtID\":2,\"isManager\":false,\"isTemporary\":false,\"company\":{\"ID\":2,\"Number\":\"CSDB\",\"Name\":\"测试库\",\"reg_num\":null,\"Address\":\"\",\"Mobile\":\"\",\"Tel\":\"\",\"legal_representative\":\"\",\"Remark\":\"\",\"CreationTime\":null,\"isAudit\":true,\"VersionID\":5,\"VersionNumber\":\"4\",\"VersionName\":\"旗舰版\"}}";
            //JObject joParma = JObject.Parse(param);
            //Console.WriteLine(uv.SetUserInfo(joParma).ToString());

            //int id = 123;
            //GBT.Tool.Core.ToolHelps.Tools tools = new GBT.Tool.Core.ToolHelps.Tools();
            //Console.WriteLine(tools.GetIdNumber(5, id.ToString()));

            //OperationTakeFoodRecord operationTakeFoodRecord = new OperationTakeFoodRecord();
            //JObject joParam = new JObject();
            //joParam["districtID"] = 2;
            //joParam["UUID"] = "20200826113703028";
            //joParam["UserID"] = 187;
            //joParam["HallID"] = 1;
            //joParam["Creator"] = 1;
            //JObject joResult = operationTakeFoodRecord.AddOrModifyTakeFoodRecord(joParam);
            //Console.WriteLine(joResult.ToString());

            //decimal b = 80M;
            //decimal c = 15M;

            //decimal a = b / c;
            //Console.WriteLine(a.ToString());

            //decimal d = Math.Ceiling(b / c);
            //Console.WriteLine(d.ToString());

            //decimal d1 = Math.Round(b / c);
            //Console.WriteLine(d1.ToString());

            //decimal d2 =  Math.Floor(b / c);
            //Console.WriteLine(d2.ToString());

            System_UserStoredValue userStoredValue = new System_UserStoredValue();
            userStoredValue.DistrictID = 2;
            userStoredValue.UserID = 187;
            userStoredValue.Value = 100;
            string msg = "";
            OpterationUserStoredValue opterationUserStoredValue = new OpterationUserStoredValue();
            int result = opterationUserStoredValue.OptUserStoredValue(userStoredValue, ref msg);
            Console.WriteLine(msg);

            Console.WriteLine("Hello World!");
            Console.ReadLine();
        }
    }
}
